package com.qf.day07.poly.tuxing;

import com.qf.day07.modifier.sta.Constants;

/**
 * 圆形
 * 子类
 */
public class Circle extends TuXing {

    // 园的半径
    private double r;

//    private double pai = 3.14;

    @Override
    public double zc() {
        // 调用父类的周长方法
        super.zc();
        // 2Πr
//        double pai = 3.14;
        double zc = 2 * Constants.PAI * r;
        System.out.println(getName()+"周长为:"+zc);
        return zc;
    }

    @Override
    public void area() {
        super.area();
        // Πrr
//        double pai = 3.14;
        double area = Constants.PAI * r * r;
        System.out.println(getName()+"面积为:"+area);
    }

    public Circle() {
        super("圆");
    }

    public Circle(String name, double r) {
        super(name);
        this.r = r;
    }

    public double getR() {
        return r;
    }

    public void setR(double r) {
        this.r = r;
    }
}
